#include <iostream>

using namespace std;

double vals[] = {10.1,12.6,33.1,24.1,50.0};

double& setValue(int i) {
    double& ref = vals[i];
    return ref;
}

int main() {
    cout << "改变前的值：" << endl;
    for(int i = 0; i < 5; i++){
        cout << "vals["<< i << "]=";
        cout << vals[i] << endl;
    }

    setValue(1) = 20.23;
    setValue(3) = 70.8;

    cout << "改变后的值：" << endl;
    for(int i = 0; i < 5; i++) {
        cout << "vals["<< i << "]=";
        cout << vals[i] << endl;
    }
}